<?php
	/**
	* 
	*/
	class carlabelModel{

		public $_table = 'carlabel';//设置表名
		
		//获取数据总数
		function count(){
			$sql = 'select count(*) from '.$this -> _table;
			return DB::findResult($sql, 0, 0);
		}
		
		//查找所有车厂牌型号置信息
		function findAll_orderby_dataline($page){
			$sql = 'select * from '.$this -> _table.' limit '.$page.', 10';  
			return DB::findAll($sql);
		}
		
		//取一组车辆厂牌型号信息
		function get_carinfo_list($page=0){
			$data = $this ->findAll_orderby_dataline($page*10);
			return $data;
		}
		
		//添加/修改厂牌型号信息
		public function carlabelsubmit($data){
			extract($data);
			if(empty($vehicleModel)||empty($passenger)){
				return 0;
			}
			$data = array(
				'vehicleModel' => addslashes($vehicleModel),'vehicleModelTypeName'	=> addslashes($vehicleModelTypeName),
				'length' 	   => addslashes($length),		'width'  		=> addslashes($width), 	
				'height'	   => addslashes($height),		'oilType' 		=> addslashes($oilType), 	 
				'capacity' 	   => addslashes($capacity),	'passenger' 	=> addslashes($passenger),   
				);
			if($_POST['carlabelid'] != ''){
				return DB::update($this -> _table, $data, 'id='.$_POST['carlabelid']);
			}else{
				return DB::insert($this -> _table, $data);
			}
		}
		
		//删除厂牌型号信息
		function carlabeldel(){
			$labelid = addslashes($_GET['labelid']);
			DB::del($this -> _table, "id = '".$labelid."'");
		}

	}
?>